package com.asp.controller;

import com.asp.model.MyPractice;
import com.asp.model.PracticeDetial;
import com.asp.result.Result;
import com.asp.service.PracticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "练习题模块接口")
@RestController
@RequestMapping("/user/test")
@CrossOrigin
public class PracticeController {
    @Resource
    private PracticeService practiceService;

    //获取练习题
    @ApiOperation(value = "获取练习题")
    @GetMapping("/source")
    public Result<List<MyPractice>> selectPractice() {
        List<MyPractice> myPractice = practiceService.selectPractice();
        return Result.success(myPractice);
    }

    //测试题详情
    @ApiOperation(value = "练习题详情")
    @GetMapping("/detial")
    public Result<List<PracticeDetial>> selectPracticeDetialByID(Integer id) {
        List<PracticeDetial> practiceDetial = practiceService.selectDetialById(id);
        return Result.success(practiceDetial);
    }
}
